summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/(procurement)/legal-review/page.tsx
blob: 441504921f3ae394093feecfeea062122848e93a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// app/(routes)/legal-works/page.tsx 수정

import * as React from "react";
import { Metadata } from "next";
import { type SearchParams } from "@/types/table";
import { Shell } from "@/components/shell";
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton";
import { InformationButton } from "@/components/information/information-button";
import { Badge } from "@/components/ui/badge"; // ✅ Badge 추가
import { SearchParamsCacheLegalWorks } from "@/lib/legal-review/validations";
import { getLegalWorks } from "@/lib/legal-review/service";
import { LegalWorksTable } from "@/lib/legal-review/status/legal-table";

export const dynamic = "force-dynamic";
export const revalidate = 0;

export const metadata: Metadata = {
  title: "법무검토 관리",
  description: "법무 검토 요청 및 답변을 관리합니다.",
};

interface LegalWorksPageProps {
  searchParams: Promise<SearchParams>;
}

export default async function LegalWorksPage({ searchParams }: LegalWorksPageProps) {
  const rawParams = await searchParams;
  const parsedSearch = SearchParamsCacheLegalWorks.parse(rawParams);
  
  // ✅ EvaluationTargetsPage와 동일한 패턴으로 currentYear 추가
  const currentYear = new Date().getFullYear();

  const promises = Promise.all([
    getLegalWorks(parsedSearch)
  ]);

  return (
    <Shell className="gap-4">
      {/* Header - EvaluationTargetsPage와 동일한 패턴 */}
      <div className="flex items-center justify-between space-y-2">
        <div className="flex items-center gap-2">
          <h2 className="text-2xl font-bold tracking-tight">법무검토 관리</h2>
          <InformationButton pagePath="evcp/legal-review" />
          {/* ✅ EvaluationTargetsPage와 동일하게 Badge 추가 */}
          <Badge variant="outline" className="text-sm">
            {currentYear}년
          </Badge>
        </div>
      </div>

      {/* Table */}
      <React.Suspense
        fallback={
          <DataTableSkeleton
            columnCount={13}
            searchableColumnCount={3}
            filterableColumnCount={4}
            cellWidths={[
              "3rem",   // checkbox
              "4rem",   // No.
              "5rem",   // 구분
              "6rem",   // 상태
              "8rem",   // Vendor Code
              "12rem",  // Vendor Name
              "4rem",   // 긴급여부
              "7rem",   // 답변요청일
              "7rem",   // 의뢰일
              "7rem",   // 답변예정일
              "7rem",   // 법무완료일
              "8rem",   // 검토요청자
              "8rem",   // 법무답변자
              "4rem",   // 첨부파일
              "8rem",   // actions
            ]}
            shrinkZero
          />
        }
      >
        {/* ✅ currentYear prop 추가 - EvaluationTargetsTable과 동일한 패턴 */}
        <LegalWorksTable 
          promises={promises} 
          currentYear={currentYear}
        />
      </React.Suspense>
    </Shell>
  );
}